/**
 * created by 小卷毛, 2020/9/14
 * Copyright (c) 2020, 416143467@qq.com All Rights Reserved.
 * #                   *********                            #
 * #                  ************                          #
 * #                  *************                         #
 * #                 **  ***********                        #
 * #                ***  ****** *****                       #
 * #                *** *******   ****                      #
 * #               ***  ********** ****                     #
 * #              ****  *********** ****                    #
 * #            *****   ***********  *****                  #
 * #           ******   *** ********   *****                #
 * #           *****   ***   ********   ******              #
 * #          ******   ***  ***********   ******            #
 * #         ******   **** **************  ******           #
 * #        *******  ********************* *******          #
 * #        *******  ******************************         #
 * #       *******  ****** ***************** *******        #
 * #       *******  ****** ****** *********   ******        #
 * #       *******    **  ******   ******     ******        #
 * #       *******        ******    *****     *****         #
 * #        ******        *****     *****     ****          #
 * #         *****        ****      *****     ***           #
 * #          *****       ***        ***      *             #
 * #            **       ****        ****                   #
 */
package com.sgcc.pda.lib_tools_database.bean.other;

import com.sgcc.pda.lib_tools_database.gen.DaoSession;
import com.sgcc.pda.lib_tools_database.gen.MeetingDetailDao;
import com.sgcc.pda.lib_tools_database.gen.MeetingStateDao;

import org.greenrobot.greendao.DaoException;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Keep;
import org.greenrobot.greendao.annotation.ToMany;

import java.util.List;

/**
 * 描 述：班前会状态详情
 * 作 者：小卷毛  2020-09-14 19:41
 * 修改描述：班前会状态表
 * 修 改 人：
 * 修改版本：v1.1
 */
@Entity
public class MeetingState {

    @Id
    private String wtNo;
    private String planNo;
    private String currentUserId;

    @ToMany(referencedJoinProperty = "wtNo")
    private List<MeetingDetail> siteMeetings;
    /**
     * Used to resolve relations
     */
    @Generated(hash = 2040040024)
    private transient DaoSession daoSession;
    /**
     * Used for active entity operations.
     */
    @Generated(hash = 532978334)
    private transient MeetingStateDao myDao;

    @Generated(hash = 596973085)
    public MeetingState(String wtNo, String planNo, String currentUserId) {
        this.wtNo = wtNo;
        this.planNo = planNo;
        this.currentUserId = currentUserId;
    }

    @Generated(hash = 933578559)
    public MeetingState() {
    }

    public String getWtNo() {
        return this.wtNo;
    }

    public void setWtNo(String wtNo) {
        this.wtNo = wtNo;
    }

    public String getPlanNo() {
        return this.planNo;
    }

    public void setPlanNo(String planNo) {
        this.planNo = planNo;
    }

    public String getCurrentUserId() {
        return this.currentUserId;
    }

    public void setCurrentUserId(String currentUserId) {
        this.currentUserId = currentUserId;
    }

    public void setSiteMeetings(List<MeetingDetail> siteMeetings) {
        this.siteMeetings = siteMeetings;
    }

    /**
     * To-many relationship, resolved on first access (and after reset).
     * Changes to to-many relations are not persisted, make changes to the target entity.
     */
    @Generated(hash = 557527341)
    public List<MeetingDetail> getSiteMeetings() {
        if (siteMeetings == null) {
            final DaoSession daoSession = this.daoSession;
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            MeetingDetailDao targetDao = daoSession.getMeetingDetailDao();
            List<MeetingDetail> siteMeetingsNew = targetDao
                    ._queryMeetingState_SiteMeetings(wtNo);
            synchronized (this) {
                if (siteMeetings == null) {
                    siteMeetings = siteMeetingsNew;
                }
            }
        }
        return siteMeetings;
    }

    /**
     * Resets a to-many relationship, making the next get call to query for a fresh result.
     */
    @Generated(hash = 52255315)
    public synchronized void resetSiteMeetings() {
        siteMeetings = null;
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 128553479)
    public void delete() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.delete(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 1942392019)
    public void refresh() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.refresh(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 713229351)
    public void update() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.update(this);
    }

    /**
     * called by internal mechanisms, do not call yourself.
     */
    @Generated(hash = 912795378)
    public void __setDaoSession(DaoSession daoSession) {
        this.daoSession = daoSession;
        myDao = daoSession != null ? daoSession.getMeetingStateDao() : null;
    }

}
